﻿#ifndef GLOBAL_MANAGER_H
#define GLOBAL_MANAGER_H

#include <QHash>
#include <QVector>
#include <QObject>
#include <QTimer>
#include "sqlite_manager.h"

extern const QString SQLITE_DB_PATH;                   // Sqlite数据库路径
extern const QString SQLITE_DB_CONNECT_NAME;           // Sqlite数据库连接标识
extern const QString PRJ_INFO_TABLE_NAME;              // 项目信息表名称
extern const QString TASK_INFO_TABLE_NAME;             // 任务信息表名称
extern const QString PLAN_INFO_TABLE_NAME;             // 计划信息表名称


struct PrjTableData
{
    QString uuid;
};

class GlobalManager : public QObject
{
public:
    static GlobalManager* getInstance();
    static void setTaskInvestmentTime(QString uuid, QVector<int> investmentTime);
    static QHash<QString, QVector<int> > getTaskInvestmentTime();
    static QString formatHHMMSSFromSecond(int second);
    void initTimer();

signals:
    void todayIsOver();

private:
    GlobalManager();
    void saveInvestmentTime();


private:
    static GlobalManager* m_instance;   // 定义静态成员指向类型为Singleton的指针
    static QHash<QString, QVector<int> > m_investmentTimeMap;
    QTimer      *m_timer;
    SqliteManager *m_sqlOperator;
};

#endif // GLOBAL_MANAGER_H
